<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class Computer{
            constructor(name,price){
                this.name =name;
                this.price=price;
            }
            sayName(){
                console.log(this.name)
            }
            sayPrice(){
                console.log(this.price)
            }
        }
        class Apple extends Computer{
            constructor(name,price,skill){
                /* 在继承的构造函数中super必须放在第一行 */
                super(name,price);
                this.skill=skill;
            }
        }
        var a=new Apple("苹果电脑",8888,"设计优秀");
        console.log(a);
        a.sayName()
        a.sayPrice()
    </script>
</body>
</html>